﻿@using  System.Web.Optimization
@model YodaMaster.Models.Student

@{
    ViewBag.Title = "Edit";
}

<h2>Edit</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Student</legend>

        @Html.HiddenFor(model => model.RecordID)

        <div class="editor-label">
            @Html.LabelFor(model => model.LastName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.LastName)
            @Html.ValidationMessageFor(model => model.LastName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.FirstMidName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FirstMidName)
            @Html.ValidationMessageFor(model => model.FirstMidName)
        </div>

           <div class="editor-label">
            @Html.LabelFor(model => model.studentType)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.studentType)
            @Html.ValidationMessageFor(model => model.studentType)
        </div>
         @foreach(var item in Model.Enrollments)
         {
            <div class="editor-label">
             @Html.LabelFor(m =>item.CourseID)
          </div>
          <div class="editor-field">
            @Html.EditorFor(m => item.CourseID)
            @Html.ValidationMessageFor(m =>item.CourseID)
          </div>
               <div class="editor-label">
             @Html.LabelFor(m =>item.Course_Name)
          </div>
          <div class="editor-field">
            @Html.EditorFor(m => item.Course_Name)
            @Html.ValidationMessageFor(m =>item.Course_Name)
          </div>
         
               <div class="editor-label">
             @Html.LabelFor(m =>item.Grade)
          </div>
          <div class="editor-field">
            @Html.EditorFor(m => item.Grade)
            @Html.ValidationMessageFor(m =>item.Grade)
          </div>
             
             
         }
 

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
